# Contributor: Frederic Wang <fred.wang@free.fr>

_realname=zope.event
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=4.2.0
pkgrel=2
pkgdesc='Very basic event publishing system (mingw-w64)'
url='https://pypi.python.org/pypi/zope.event'
license=('ZPL 2.1')
arch=('any')
makedepends=("${MINGW_PACKAGE_PREFIX}-python2"
             "${MINGW_PACKAGE_PREFIX}-python3"
             "${MINGW_PACKAGE_PREFIX}-python2-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python3-setuptools")
_dtoken="cd/a5/4927363244aaa7fd8a696d32005ea8214c4811550d35edea27797ebbd4fd"
source=("https://pypi.python.org/packages/${_dtoken}/${_realname}-${pkgver}.tar.gz")
sha256sums=('ce11004217863a4827ea1a67a31730bddab9073832bdb3b9be85869259118758')

prepare() {
  cd ${srcdir}
  cp -r ${_realname}-${pkgver} build-python2
  cp -r ${_realname}-${pkgver} build-python3
}

package_python3-zope.event() {
  cd ${srcdir}/build-python3
  ${MINGW_PREFIX}/bin/python3 setup.py build
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}"

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE.txt" "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE"
}

package_python2-zope.event() {
  cd ${srcdir}/build-python2
  ${MINGW_PREFIX}/bin/python2 setup.py build
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}"

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE.txt" "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE"
}

package_mingw-w64-i686-python2-zope.event() {
  package_python2-zope.event
}

package_mingw-w64-i686-python3-zope.event() {
  package_python3-zope.event
}

package_mingw-w64-x86_64-python2-zope.event() {
  package_python2-zope.event
}

package_mingw-w64-x86_64-python3-zope.event() {
  package_python3-zope.event
}
